# print(range(10, 1, -2))
# print(list(range(10, 1, -2)))

# for i in range(10):
#     print('found it! i = %s' % i)
#     if i == 5:
#         print('found it! i = %s' % i)
#         break
# else:
#     print('not found it ...')
#
#
# class MyEmptyClass:
#     pass

#
# i = 3
# while i < 5:
#     print(i)
#     i += 1
# else:
#     print("循环结束")
#
#
# def my_function(first_arg, default_arg=None):
#     """ 这个字符串是函数的文档字符串 """
#     print(f"{first_arg}, {default_arg}")
#     pass
#
#
# my_function("a", default_arg="b")

#
# def demo_default_arg(first_arg, default_arg=1):
#     print(first_arg * default_arg)
#
#
# demo_default_arg("使用默认参数")
# demo_default_arg("不使用默认参数", 2)


# def demo_var_param(first_arg, *tuple_args, **dict_args):
#     print(f"{first_arg}")
#
#     for tuple_arg in tuple_args:
#         print(f"{tuple_arg}")
#
#     for k, v in dict_args:
#         print(f"k: {k}, v: {v}")
#
#
# demo_var_param("单个", "a", 1, True, {"123": "abc"})

#
# list(range(3, 6))  # normal call with separate arguments
# args = [3, 6]
# list(range(*args))  # call with arguments unpacked from a list

# 以同样的方式，可以使用 ** 操作符分拆关键字参数为字典

# li = [11, 22, 33]
# sl = [1, 2, 3]
# new_list = map(lambda a, b: a + b, li, sl)

#
# li = [11, 22, 33]
#
# new_list = list(map(lambda a: a + 100, li))
# print(new_list)
#
# li = [11, 22, 33]
# sl = [1, 2, 3]
# new_list = list(map(lambda a, b: a + b, li, sl))
# print(new_list)


# def demo_lambda():
#     return
#
# demo_lambda = lambda x: x + 10
# print(demo_lambda(12))

#
# x = True
#
#
# def demo_method_a():
#     global x
#     print(f"a1: {x}")
#     x = 9
#     print(f"a1: {x}")
#
#
# def demo_method_b():
#     global x
#     print(f"b1: {x}")
#     x = "a"
#     print(f"b2: {x}")
#
#
# def demo_method_c():
#     x = False
#     print(f"c: {x}")
#
#
# print(f"begin: {x}")
# demo_method_a()
# demo_method_b()
# demo_method_c()
# print(f"end: {x}")

#
# def make_counter():
#     count = 0
#
#     def counter():
#         nonlocal count
#         count += 1
#         return count
#
#     return counter
#
#
# def make_counter_test():
#     mc = make_counter()
#     print(mc())
#     print(mc())
#     print(mc())
#
#
# make_counter_test()

# a = (1, 2)
# b = 1, 2
# print(f"a == b: {a == b}")
# print(f"a: {a}")
# print(f"b: {b}")
#
# def add(x: int, y: int) -> int:
#     return x + y
#
#
# print(add(1, 3))



